package org.algorithm.biubiu.wheel_1.数组.三月.第三周;

import org.junit.Test;

/**
 * @Date 2022/3/14 17:36
 * @Created by biubiu
 * @Link {https://leetcode-cn.com/problems/find-pivot-index/}
 */
public class NumArray {


    int[] sum  = null;

    public NumArray(int[] nums) {
        this.sum = new int[nums.length+1];
        for(int i=0;i<nums.length;i++){
            this.sum[i+1] = this.sum[i]+ nums[i];
        }
    }

    public int sumRange(int left, int right) {
        return  this.sum[right+1]- this.sum[left];

    }

    public NumArray(){}


}
